package com.demo2do.fms.admin.dao.supplier;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.demo2do.fms.entity.appraisal.Appraisal;
import com.demo2do.fms.entity.appraisal.AppraisalResultItem;
import com.demo2do.fms.entity.appraisal.AppraisalResult;

/**
 *
 * @author Ark
 *
 */
@Dao("hibernate")
public interface AppraisalResultItemDao {
    
    /**
     * @param appraisalResult
     * @return
     */
    @Query("FROM AppraisalResultItem WHERE disabled = false AND result = :result ORDER BY parent ASC")
    public List<AppraisalResultItem> list(@Variable("result") AppraisalResult appraisalResult);
    
    /**
     * @param appraisal
     * @return
     */
    @Query("FROM AppraisalResultItem WHERE disabled = false AND appraisal = :appraisal ORDER BY parent ASC")
    public List<AppraisalResultItem> list(@Variable("appraisal") Appraisal appraisal);
    
    /**
     * @param resultIds
     * @return
     */
    @Query("FROM AppraisalResultItem WHERE disabled = false AND result.id IN(:resultIds) ORDER BY parent.id ASC")
    public List<AppraisalResultItem> listByResult(@Variable("resultIds") List<Long> resultIds);
    
}
